{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "53\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import seaborn as sns\n",
    "import matplotlib as mp\n",
    "import matplotlib.pyplot as plt\n",
    "import  scipy.special as sp  #gammaln函数\n",
    "Before6City=pd.read_csv('CityBefore6City202003302.csv')\n",
    "Before3City=pd.read_csv('CityBefore3City202003302.csv')\n",
    "NowCity=pd.read_csv('City202003302.csv')\n",
    "NowCityUp95=pd.read_csv('Up95City202003302.csv')\n",
    "NowCityDown95=pd.read_csv('Down95City202003302.csv')\n",
    "Delay3City=pd.read_csv('CityDelay3City202003302.csv')\n",
    "Delay6City=pd.read_csv('CityDelay6City202003302.csv')\n",
    "DATE=['Jan 9','Jan 10','Jan 11','Jan 12','Jan 13','Jan 14','Jan 15','Jan 16','Jan 17','Jan 18','Jan 19','Jan 20',\n",
    "      'Jan 21','Jan 22','Jan 23','Jan 24','Jan 25','Jan 26','Jan 27',\n",
    "                     'Jan 28','Jan 29','Jan 30','Jan 31','Feb 1','Feb 2','Feb 3','Feb 4',\n",
    "                     'Feb 5','Feb 6','Feb 7','Feb 8','Feb 9','Feb 10','Feb 11','Feb 12','Feb 13',\n",
    "                     'Feb 14','Feb 15','Feb 16','Feb 17','Feb 18','Feb 19','Feb 20','Feb 21',\n",
    "                      'Feb 22','Feb 23',\n",
    "                     'Feb 24','Feb 25','Feb 26','Feb 27','Feb 28','Feb 29','March 1']\n",
    "print(len(DATE))\n",
    "A=np.arange(0,len(Before6City.index),3)\n",
    "\n",
    "plt.figure()\n",
    "#plt.plot(DATE,Before6City.loc[A,'Beijing_H'],label='6 Days earlier')\n",
    "#plt.plot(DATE,Before3City.loc[A,'Beijing_H'],label='3 Days earlier')\n",
    "plt.plot(DATE,NowCity.loc[A,'Beijing_H'],label='正常')\n",
    "plt.fill_between(DATE, NowCityDown95.loc[A,'Beijing_H'].values, NowCityUp95.loc[A,'Beijing_H']\n",
    "                 , facecolor='green', alpha=0.05)\n",
    "plt.plot(DATE,Delay3City.loc[A,'Beijing_H'],label='3天后')\n",
    "plt.plot(DATE,Delay6City.loc[A,'Beijing_H'],label='6天后')\n",
    "plt.xticks(rotation=60)\n",
    "#x_major_locator=MultipleLocator(1)#把x轴的刻度间隔设置为1，并存在变量里\n",
    "#y_major_locator=MultipleLocator(10)#把y轴的刻度间隔设置为10，并存在变量里\n",
    "ax=plt.gca()#ax为两条坐标轴的实例\n",
    "ax.xaxis.set_major_locator(mp.ticker.MultipleLocator(5)) # 解决刻度过密\n",
    "plt.legend(loc='upper left', borderaxespad=0.)\n",
    "ax.spines['top'].set_visible(False)\n",
    "ax.spines['right'].set_visible(False)\n",
    "plt.title('市内控制措施对北京影响')\n",
    "plt.savefig('市内交通管制对北京影响.png',dpi=100, bbox_inches='tight')\n",
    "\n",
    "plt.figure()\n",
    "#plt.plot(DATE,Before6City.loc[A,'Wuhan_H'],label='6 Days earlier')\n",
    "#plt.plot(DATE,Before3City.loc[A,'Wuhan_H'],label='3 Days earlier')\n",
    "plt.plot(DATE,NowCity.loc[A,'Wuhan_H'],label='正常')\n",
    "plt.fill_between(DATE, NowCityDown95.loc[A,'Wuhan_H'].values, NowCityUp95.loc[A,'Wuhan_H']\n",
    "                 , facecolor='green', alpha=0.05)\n",
    "plt.plot(DATE,Delay3City.loc[A,'Wuhan_H'],label='3 天后')\n",
    "plt.plot(DATE,Delay6City.loc[A,'Wuhan_H'],label='6 天后')\n",
    "plt.xticks(rotation=60)\n",
    "#x_major_locator=MultipleLocator(1)#把x轴的刻度间隔设置为1，并存在变量里\n",
    "#y_major_locator=MultipleLocator(10)#把y轴的刻度间隔设置为10，并存在变量里\n",
    "ax=plt.gca()#ax为两条坐标轴的实例\n",
    "ax.xaxis.set_major_locator(mp.ticker.MultipleLocator(5)) # 解决刻度过密\n",
    "plt.legend(loc='upper left', borderaxespad=0.)\n",
    "ax.spines['top'].set_visible(False)\n",
    "ax.spines['right'].set_visible(False)\n",
    "plt.title('市内控制措施对武汉影响')\n",
    "plt.savefig('市内交通管制对武汉影响.png',dpi=100, bbox_inches='tight')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
